#ifndef CPP_TOOLS_DLOG_FORMAT_H
#define CPP_TOOLS_DLOG_FORMAT_H
#pragma once

#include <cstring>
#include <ctime>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

namespace util {
namespace dlog {
namespace format {

std::string get_head(const char *filename, const size_t &line_number,
                     const size_t &log_level);

template <class stl_container>
std::string ContainerToString(const stl_container &arr) {
  std::stringstream ss;
  auto iter = arr.begin();
  if (iter == arr.end()) {
    return std::string("[]");
  }
  ss << '[' << *iter;
  iter++;
  for (; iter != arr.end(); iter++) {
    ss << ',' << *iter;
  }
  ss << ']';
  // in order to avoid double free.
  return std::string(ss.str());
}

} // namespace format
} // namespace dlog
} // namespace util

#endif